package com.kuang.services;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class readFiles extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

//        InputStream steam = this.getServletContext().getResourceAsStream("/WEB-INF/classes/db.properties");
         InputStream  steam=this.getServletContext().getResourceAsStream("/WEB-INF/classes/com/kuang/services/static.properties");
        Properties prop = new Properties();
//        prop.load(steam);
        prop.load(steam);
//        String username = prop.getProperty("username");
//        String password = prop.getProperty("password");
        String abcefg = prop.getProperty("abcefg");
//        resp.getWriter().println(username+":"+password);
resp.getWriter().println(abcefg);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
